﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyOA.DAL;
using MyOA.Model;

namespace MyOA.BLL
{
   public class SaveMyScheduleManage
    {
       SaveMyScheduleService service = new SaveMyScheduleService();
        /// <summary>
        /// 获得所有会议类型集合
        /// </summary>
        /// <returns>会议类型集合</returns>
        public IList<MeetingInfo> getAllMeetings()
        {
            return service.getAllMeetings();
        }

        /// <summary>
        /// 根据个人日程ID来获取这日程的预约人信息的集合
        /// </summary>
        /// <param name="scheduleId">个人日程ID</param>
        /// <returns>预约人信息集合</returns>
        public IList<UserInfo> getUserInfosByScheduleId(int scheduleId)
        {
            return service.getUserInfosByScheduleId(scheduleId);
        }

        /// <summary>
        /// 新增预约人表信息
        /// </summary>
        /// <param name="preContract">预约人表信息</param>
        /// <returns>是否新增成功</returns>
        public bool insertPreContract(PreContract preContract)
        {
            return service.insertPreContract(preContract);
        }


        /// <summary>
        /// 新增个人日程
        /// </summary>
        /// <param name="schedule">要新增的个人日程的数据</param>
        /// <returns>是否新增成功</returns>
        public bool insertSchedule(Schedule schedule)
        {
            return service.insertSchedule(schedule);
        }

        /// <summary>
        /// 根据登陆号来获取登陆用户信息
        /// </summary>
        /// <param name="loginId">登陆号</param>
        /// <returns>登陆用户信息</returns>
        public UserInfo getUserInfoByLoginId(string loginId)
        {
            return service.getUserInfoByLoginId(loginId);
        }

       /// <summary>
        /// 修改个人日程信息
        /// </summary>
        /// <param name="schedule">个人日程ID</param>
        /// <returns>是否修改成功</returns>
        public bool updateScheduleByScheduleId(Schedule schedule)
        {
            return service.updateScheduleByScheduleId(schedule);
        }

        /// <summary>
        /// 获取全部的用户信息
        /// <returns>全部的用户信息</returns>
        public IList<UserInfo> getAllUserInfo()
        {
            return service.getAllUserInfo();
        }

        /// <summary>
        /// 获取全部的部门信息
        /// </summary>
        /// <returns>部门信息集合</returns>
        public IList<DepartInfo> getAllDepartInfo()
        {
            return service.getAllDepartInfo();
        }

       /// <summary>
        /// 获取全部的机构信息
        /// </summary>
        /// <returns>获取全部的机构信息</returns>
        public IList<BranchInfo> getAllBranchInfo()
        {
            return service.getAllBranchInfo();
        }

       /// <summary>
        /// 根据预约人ID和日程信息 来增加个人日程和预约信息
        /// </summary>
        /// <param name="schedule">个人日程信息</param>
        /// <param name="usersId">预约人组成的字符串</param>
        /// <returns>是否成功</returns>
        public int insertScheduleAndPreContract(Schedule schedule, string usersId)
        {
            return service.insertScheduleAndPreContract(schedule,usersId);
        }

       /// <summary>
        /// 根据个人日程ID查找预约人信息集合
        /// </summary>
        /// <param name="scheduleId">个人日程ID</param>
        /// <returns>预约人信息集合</returns>
        public IList<PreContract> getPreContractByScheduleId(int scheduleId)
        {
            return service.getPreContractByScheduleId(scheduleId);
        }

       /// <summary>
        /// 根据个人日程ID 来删除带有预约人信息（同时删除2张表的数据）
        /// </summary>
        /// <param name="scheduleId"></param>
        /// <returns></returns>
        public bool DeleteScheduleAndPreContractByScheduleId(int scheduleId)
        {
            return service.DeleteScheduleAndPreContractByScheduleId(scheduleId);
        }

       /// <summary>
        /// 根据个人日程ID 来删除带有预约人信息（删除1张表的数据）
        /// </summary>
        /// <param name="scheduleId"></param>
        /// <returns></returns>
        public bool DeleteScheduleByScheduleId(int scheduleId)
        {
            return service.DeleteScheduleByScheduleId(scheduleId);
        }

       /// <summary>
        /// 修改个人日程并增加预约人信息
        /// </summary>
        /// <param name="schedule">个人日程信息</param>
        /// <param name="usersId">增加预约人的条件字符串 即USERID</param>
        /// <returns>影响的行数</returns>
        public int updateScheduleAndInsertPreContract(Schedule schedule, string usersId)
        {
            return service.updateScheduleAndInsertPreContract(schedule, usersId);
        }

       /// <summary>
        /// 修改个人日程并删除预约人信息
        /// </summary>
        /// <param name="schedule">个人日程信息</param>
        /// <param name="usersId">删除预约人的条件字符串 即USERID</param>
        /// <returns>影响的行数</returns>
        public int updateScheduleAndDeletePreContract(Schedule schedule, string usersId)
        {
            return service.updateScheduleAndDeletePreContract(schedule,usersId);
        }

       /// <summary>
        /// 修改个人日程并增加预约人和删除预约人
        /// </summary>
        /// <param name="schedule">要修改的个人日程信息</param>
        /// <param name="insertUserId">增加预约人的USERID字符串</param>
        /// <param name="deleteUserId">删除预约人的USERID字符串</param>
        /// <returns></returns>
        public int updateScheduleAndInsertAndDeletePreContract(Schedule schedule, string insertUserId, string deleteUserId)
        {
            return service.updateScheduleAndInsertAndDeletePreContract(schedule,insertUserId,deleteUserId);
        }

       /// <summary>
        /// 根据日程ID获取个人日程信息
        /// </summary>
        /// <param name="scheduleId">个人日程ID</param>
        /// <returns>个人日程信息</returns>
        public Schedule getScheduleByScheduleId(int scheduleId)
        {
            return service.getScheduleByScheduleId(scheduleId);
        }
    }
}
